import {
  Component,
  ChangeDetectionStrategy,
  OnInit,
  OnDestroy,
  Input,
  ChangeDetectorRef,
  NgZone,
  AfterViewInit,
} from '@angular/core';
import { Subscription } from 'rxjs';
import { ProductViewComponent } from '../../product-view/product-view.component';

/**
 * 产品摘要
 */
@Component({
  selector: 'product-view-summary',
  templateUrl: './product-summary.component.html',
  styleUrls: ['./product-summary.component.less'],
  host: {},
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ProductSummaryComponent implements OnInit, OnDestroy {
  _product = null;

  @Input()
  set product(val) {
    this._product = val;
    if (this._product && this._product.pic) {
      this.url = `${window.location.origin + window.location.pathname}/cf/admin/sysfile/f/${this._product.pic}`;
    }
    this.cdr.detectChanges();
  }
  @Input()
  extra = null;
  @Input()
  price = null;
  url = null;

  constructor(private cdr: ChangeDetectorRef, private p: ProductViewComponent, private ngZone: NgZone) {}

  ngOnInit(): void {}

  ngOnDestroy(): void {}
}
